﻿function mainmenu(ctrlul, ctrlli) {
    $(ctrlul).css({ display: "none" });
    $(ctrlli).hover(function () {
        $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(400);
    }, function () {
        $(this).find('ul:first').css({ visibility: "hidden", display: "none" });
    });
}

function LoadForm(name, oncomplete) {
    $.ajax({ url: '../Forms/' + name, type: "POST",
        success: function (data) {
            oncomplete(data);
        }
    });
}


function ProcessRequest(name, opener, listrefreshed) {
    $.ajax({ url: '../ProcessRequest/' + name, type: "POST",
        success: function (response) {
            alert(response);
            if (response.indexOf('Success') > 0) {
                $(opener).dialog('close');
                if (listrefreshed != null) {
                    var table = $(listrefreshed).dataTable();
                    table.fnDraw();
                }
            }
            else
                return false;
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert(xhr.responseText);
        }
    });
}
